<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <base id="base" href="${s.basePath}">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>home</title>
    <link rel="stylesheet" type="text/css" href="${s.basePath}/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${s.basePath}/easyui/themes/icon.css">
    <script type="text/javascript" src="${s.basePath}/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="${s.basePath}/easyui/jquery.easyui.min.js"></script>
</head>
<body class="easyui-layout">
<div data-options="region:'north',title:'',split:true" style="height:80px;">
    <h2 style="text-align: center;margin: 20px;">三牛博客系统</h2>
    <div style="position: absolute;right: 20px;top: 20px;">欢迎您，${Session.user.role.rolename!}
        <a href="javascript:void(0)" id="mb" class="easyui-menubutton"
           data-options="menu:'#mm',iconCls:'icon-man'">选项</a>
        <div id="mm" style="width:150px;">
            <div data-options="iconCls:'icon-undo'" id="logout">安全退出</div>
            <div data-options="iconCls:'icon-redo'" id="changePwd">修改密码</div>
        </div>
    </div>
</div>
<div data-options="region:'south',title:'',split:true,collapsible:false" style="height:55px;">
    <p style="text-align: center">&copy;三牛工作室版权所有</p>
</div>

<div data-options="region:'west',title:'菜单',split:true" style="width:180px;">
    <ul id="menu"></ul>
</div>
<div data-options="region:'center',title:''" style="padding:5px;background:#eee;">
    <div id="main_tabs" class="easyui-tabs" data-options="fit:true">
        <div title="首页" style="padding:20px;display:none;">
            tab1
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    $(function () {
        var basePath = $("#base").attr("href");
        console.log(basePath);
        $('#menu').tree({
            url: basePath + '/getMenu',
            lines: true,
            onClick: function (node) {
                var tabName = node.text;
                var attrs = node.attributes;
                // console.log(attrs);
                var result = $("#main_tabs").tabs('getTab', tabName);
                if (result != null) {
                    $("#main_tabs").tabs('select', tabName);
                } else {
                    $("#main_tabs").tabs('add', {
                        title: tabName,
                        closable: true,
                        href: basePath + "/" + attrs.url
                    })
                }
            }

        });

        $("#logout").on('click',function () {
            $.messager.confirm('登出系统','你确认要登出系统吗',function (r) {
                if (r){
                    top.location.href=basePath + 'logout';
                }
            })
        })
    })
</script>
</html>